<?php

ob_start();
@session_start();


ini_set('error_reporting', -1);
date_default_timezone_set('ASIA/SAIGON');
setlocale(LC_ALL, 'en_US.utf-8');
date_default_timezone_set('America/Chicago');

define('PROTOCOL', 'http://');
define('HOST', 'localhost');
define('BASE_URL', '/startup/');

define('ROOT_DIR', realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR);
define('APP_DIR', ROOT_DIR . 'application' . DIRECTORY_SEPARATOR);
define('LIB_DIR', ROOT_DIR . 'lib' . DIRECTORY_SEPARATOR);
define('CORE_DIR', ROOT_DIR . 'h2' . DIRECTORY_SEPARATOR);
define('PACKAGE_DIR', APP_DIR . 'package' . DIRECTORY_SEPARATOR);
define('TEMP_DIR', ROOT_DIR . 'temp' . DIRECTORY_SEPARATOR);
define('LOG_DIR', TEMP_DIR . 'log' . DIRECTORY_SEPARATOR);
define('LAYOUT_DIR', ROOT_DIR . 'layout' . DIRECTORY_SEPARATOR);

set_include_path(get_include_path() . PATH_SEPARATOR . CORE_DIR . PATH_SEPARATOR . LIB_DIR . PATH_SEPARATOR . PACKAGE_DIR);

function __autoload($class_name) {
  require_once str_replace('_', DIRECTORY_SEPARATOR, $class_name) . '.php';
}


Core::dispatch();
Response::getInstance()->sendLayout();
ob_flush();
Logger::flush();